import request from '@/utils/request.js';

// 获取用户信息
export const getInfo = () => {
	return request({
		method: 'GET',
		url: '/getInfo'
	});
}

// 获取用户资料
export const getUserProfile = () => {
	return request({
		method: 'GET',
		url: '/system/user/profile'
	});
}

// 修改用户信息
export const updateUserInfo = (params) => {
	return request({
		method: 'PUT',
		url: '/system/user/profile',
		data: params
	});
}

// 退出登录
export const logout = () => {
	return request({
		method: 'POST',
		url: '/logout'
	});
}

// 修改密码
export const updataUserPwd = (oldPassword, newPassword) => {
  return request({
    method: 'PUT',
	// 修改密码后端不接受对象类型
    url: `/system/user/profile/updatePwd?oldPassword=${oldPassword}&newPassword=${newPassword}`,
  });
};